<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/public/header.jsp"%>
<%
    String callback = request.getParameter("callback");
String c_s_id = request.getParameter("c_s_id") == null ? "" : request.getParameter("c_s_id");
String isShow = request.getParameter("isShow") == null ? "" : request.getParameter("isShow");
Map<String, Object> sessionMap = (Map<String, Object>) session.getAttribute("LOGIN_USER");
String person_id = String.valueOf(sessionMap.get("id"));
String person = String.valueOf(sessionMap.get("truename"));
boolean isAdd = "".equals(c_s_id);
int flag = 0;
if(!isAdd){
	flag = 1;
}
%>
<html>
	<head>
		<title>厂家库产品录入管理</title>
		<script type="text/javascript" src="<%=contextPath %>/public/js/extend.js"></script>
		<style>
			.td1{
				padding-top:10px;
				padding-bottom:5px;
				font-size: 12px;
				background-color: #c0ebd7;
				width:20%;
			}
			.td2{
				padding:5px;
			}
			.datagrid-cell {
			  font-size: 18px;
			}
		</style>
	<script type="text/javascript">
		$(function(){
			$.ajax({
				type:'GET',
				url:'<%=contextPath %>/springMVC/warehouse/getCustomerMaterialById?c_s_id=<%=c_s_id%>',
				success:function(rtData){
					$('#in_code').html(rtData.in_code);
					$('#warehouse_name').html(rtData.warehouse_name);
					$('#supplier_name').html(rtData.supplier_name);
					 $('#person_name').html(rtData.person_name);
					 $('#operation_date').html(rtData.operation_date);
					 $('#remark').html(rtData.remark);
					 $('#in_code').html(rtData.in_code);
				}
			});
			$('#table').datagrid({
				<%=isAdd?"url:'',":"url:'"+contextPath+"/springMVC/warehouse/getCSMaterialByCsId?c_s_id="+c_s_id+"',"%>
				rownumbers:true,
				fitColumns:true,
				columns:[[
					{title:'产品编号',field:'code',width:100,align:'center'},
					{title:'产品名称',field:'name',width:200,align:'center'},
					{title:'规格/型号',field:'format_type',width:200,align:'center'},
					{title:'单位',field:'unit_name',width:50,align:'center'},
					{title:'录入数量',field:'num',width:100,align:'center'},
					{title:'备注',field:'remark',width:260,align:'center'}
				]]
			});
			
		});
		
		function startPrint(obj){
			$(obj).hide();
			window.print();
		}
	</script>
	</head>
	<body>
		<div style="width: 90%;padding-left:50px">
		<form id="ff">
			<table  style="border-collapse: collapse;" width="100%" border="1px" bordercolor="#0eb83a">
			<tr>
					<td class="td2" align="center" colspan="4">
						<b><span  id="title">产品入厂家库</span></b>
					</td>
				</tr>
				<tr>
					<td align="right" class="td1" nowrap>入库单号：</td>
					<td class="td2" nowrap  > 
						<span  id="in_code" name="in_code"  ></span>
					</td>
					<td align="right" class="td1" nowrap>选择仓库：</td>
					<td class="td2" nowrap  > 
						<span  id="warehouse_name" name="warehouse_name" ></span>
					</td>
				</tr>
				<tr>
					<td align="right" class="td1" nowrap>选择厂家：</td>
					<td class="td2" nowrap >
						<span  id="supplier_name" name="supplier_name" ></span>
					</td>
					<td align="right" class="td1" nowrap>申请人：</td>
					<td class="td2" nowrap>
						<span  id="person_name" name="person_name" ></span>
					</td>
				</tr>
				<tr>
					<td align="right" class="td1" nowrap>入库时间：</td>
					<td class="td2" nowrap colspan="3">
						<span  id="operation_date" name="operation_date" ></span>
					</td>
				</tr>
				<tr>
					<td align="right" class="td1" nowrap>摘要：</td>
					<td class="td2" nowrap colspan='3'>
						<span  id="remark" name="remark"  ></span>
					</td>
				</tr>
				<tr>
					<td colspan="4"  nowrap>
						<div id="table"></div>
					</td>
				</tr>
				<tr>
					<td align="right" class="td1" nowrap></td>
					<td class="td2" nowrap colspan='4'>
						<div align="left">
							<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-print',plain:false" onclick="startPrint(this);">确认打印</a>
						</div>
					</td>
				</tr>
			</table>
			</form>
		</div>
	</body>
</html>